Skip to content

Fixed gcc -Wstringop-overflow and -Wdeprecated-declarations.#13

Open
AbdallaDalleh wants to merge 1 commit into
epics-modules:mainfrom
AbdallaDalleh:fix-gcc-warnings
Open

Fixed gcc -Wstringop-overflow and -Wdeprecated-declarations.#13
AbdallaDalleh wants to merge 1 commit into
epics-modules:mainfrom
AbdallaDalleh:fix-gcc-warnings

Conversation

@AbdallaDalleh

Copy link
Copy Markdown

1st warning:

../seq_mac.c: In function ‘seqMacEval’:
../seq_mac.c:81:5: warning: ‘strncpy’ specified bound depends on the length of the 
source argument [-Wstringop-overflow=]
     strncpy(outStr, value, valLth);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../seq_mac.c:75:14: note: length computed here
     valLth = strlen(value);

seqMacEval already passes the destination size as the 4th argument maxChar, this is clear in various calls:

  • src/seq/seq_main.c:395
  • src/seq/seq_if.c:668

2nd warning:

../../../include/seqMain.c: In function ‘main’:
../../../include/seqMain.c:28:9: warning: ‘epicsThreadExitMain’ is deprecated 
[-Wdeprecated-declarations]
         epicsThreadExitMain();

function call has been replaced with a loop+sleep, as the deprecation notice suggest. Similar case exist in test/validate/seqMain.c

1st warning:
../seq_mac.c: In function ‘seqMacEval’:
../seq_mac.c:81:5: warning: ‘strncpy’ specified bound depends on
the length of the source argument [-Wstringop-overflow=]
     strncpy(outStr, value, valLth);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../seq_mac.c:75:14: note: length computed here
     valLth = strlen(value);

seqMacEval already passes the destination size as the 4th argument
maxChar, this is clear in various calls:
  - src/seq/seq_main.c:395
  - src/seq/seq_if.c:668

2nd warning:
../../../include/seqMain.c: In function ‘main’:
../../../include/seqMain.c:28:9: warning: ‘epicsThreadExitMain’
is deprecated [-Wdeprecated-declarations]
         epicsThreadExitMain();

function call has been replaced with a loop+sleep, as the deprecation
notice suggest. Similar call exist in test/validate/seqMain.c
@ralphlange

Copy link
Copy Markdown
Member

Careful with the 2nd one:
This probably depends on the version of Base, and the sequencer needs to be working against a whole range...

@ralphlange

Copy link
Copy Markdown
Member

Works fine across Base versions, it seems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants